package com.example.science.util;

import lombok.Data;

//返回数据统一工具类
@Data
public class Result<T> {
    private int code;
    private String message;
    private T  data;
    public Result(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static Result success(String message,Object data) {
      return new  Result(200,message,data);

    }

    public static Result fail(String message){
        return new Result(500, message, null);

    }
    public static  Result noAuth(){
        return new Result(401, "未登录或令牌无效", null);
    }
}
